Skip to content

Chore ci snap - #2761

Merged
lzxue merged 12 commits into
masterfrom
chore_ci_snap
Sep 19, 2025
Merged

Chore ci snap#2761
lzxue merged 12 commits into
masterfrom
chore_ci_snap

Conversation

@lzxue

@lzxue lzxue commented Sep 19, 2025

Copy link
Copy Markdown
Contributor

[English Template / 英文模板]

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 工作流程
  • 版本更新
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

语言 更新描述
🇺🇸 英文
🇨🇳 中文

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@changeset-bot

changeset-bot Bot commented Sep 19, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2e4daba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@antv/l7-test-utils Patch
@antv/l7-component Patch
@antv/l7-renderer Patch
@antv/l7-layers Patch
@antv/l7-source Patch
@antv/l7-scene Patch
@antv/l7-three Patch
@antv/l7-utils Patch
@antv/l7-core Patch
@antv/l7-maps Patch
@antv/l7-map Patch
@antv/l7 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @lzxue, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the L7 mapping library by introducing new examples for advanced functionalities like map image export and PMTiles integration. It also includes several targeted bug fixes and code quality improvements across different packages, contributing to a more robust and user-friendly development experience.

Highlights

  • New Examples for Map Image Export: Introduced a new example (export-image.ts) demonstrating how to export map images (PNG/JPEG) from the L7 scene, complete with a user interface for format selection, export, and download.
  • PMTiles Integration Examples: Added two new examples (pmtile_raster.ts and pmtile_vector.ts) to showcase the integration of PMTiles for both raster and vector tile data, by adding a pmtiles protocol to the Scene.
  • VSCode JSON Formatter Configuration: Updated .vscode/settings.json to include a default formatter for JSON files, ensuring consistent code style.
  • WebGL Context Preservation for Image Export: Modified the CaseScene utility to explicitly set preserveDrawingBuffer: true in WebGLParams, which is essential for enabling reliable image export functionality.
  • Bug Fixes and Code Improvements: Implemented several bug fixes and minor improvements, including type casting in earth/utils.ts, enhanced createDataTexture in wind/models/utils.ts to handle different image data types, updated test assertions, and ensured customLayerMatrix() returns a cloned matrix to prevent unintended side effects. Also, added a check for map initialization before image export in amap-next/map.ts.
  • Changelog Entry for Patch Release: A new changeset file (odd-pianos-hope.md) was added, indicating a patch release for multiple @antv/l7 packages to address various bugs.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several new examples, including map image export and PMTiles support, along with various fixes and improvements across the codebase. My review focuses on improving the correctness and maintainability of the new examples, such as fixing a bug in the image export logic and making asynchronous operations more robust. I've also pointed out areas where debug code like console.log should be removed and where error handling and code assumptions can be strengthened for better stability.

Comment on lines +162 to +169
// @ts-ignore
const format = formatSelect.value as 'png' | 'jpg';
//@ts-ignore
console.log('format', scene.mapService);
//@ts-ignore
const dataURL = await scene.mapService.exportMap('png');
// 使用场景的导出方法
// const dataURL = await scene.exportMap(format)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The image export functionality has a few issues:

  1. The image format is hardcoded to 'png' in scene.mapService.exportMap('png'), ignoring the user's selection from the dropdown. The format variable should be used instead.
  2. There are several @ts-ignore comments and a console.log which should be removed from production/example code.
  3. The commented-out line // const dataURL = await scene.exportMap(format) suggests the correct method might be on the scene object itself. Please ensure you are using the correct API.
        const format = formatSelect.value as 'png' | 'jpg';
        const dataURL = await scene.mapService.exportMap(format);

'@antv/l7': patch
---

修复一些bug

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description "修复一些bug" (fix some bugs) is too generic. For better maintainability and clearer release notes, please provide a more specific summary of the bugs that were fixed in this changeset.

Comment on lines +49 to +58
await new Promise((resolve) => {
const checkRender = () => {
if (scene.getLayers().every((layer) => layer.isVisible())) {
resolve(true);
} else {
setTimeout(checkRender, 100);
}
};
checkRender();
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using setTimeout in a loop to check if a layer is rendered is inefficient and can be unreliable. A better approach is to use the inited event on the layer, which signals that it's ready.

  await new Promise<void>((resolve) => {
    pointLayer.once('inited', () => {
      resolve();
    });
  });

Comment on lines +6 to +7
//@ts-ignore
Scene.addProtocol('pmtiles', protocol.tile);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The @ts-ignore comment should be avoided. If Scene.addProtocol is a valid method but lacks type definitions, consider casting Scene to any like (Scene as any).addProtocol(...) for clarity. Even better would be to update the type definitions for Scene to include addProtocol if it's part of the public API.

Suggested change
//@ts-ignore
Scene.addProtocol('pmtiles', protocol.tile);
(Scene as any).addProtocol('pmtiles', protocol.tile);

Comment on lines +6 to +7
//@ts-ignore
Scene.addProtocol('pmtiles', protocol.tile);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The @ts-ignore comment should be avoided. If Scene.addProtocol is a valid method but lacks type definitions, consider casting Scene to any like (Scene as any).addProtocol(...) for clarity. Even better would be to update the type definitions for Scene to include addProtocol if it's part of the public API.

Suggested change
//@ts-ignore
Scene.addProtocol('pmtiles', protocol.tile);
(Scene as any).addProtocol('pmtiles', protocol.tile);

Comment on lines +112 to +115
// 对于 ArrayBuffer 或其他数据类型,需要提供宽度和高度
const width = Math.sqrt(data.length / 4); // 假设是RGBA格式,每个像素4个值
const height = width;
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic to infer texture dimensions assumes the texture is always square (width = height = Math.sqrt(...)). This is fragile and will fail if the texture data is not from a square texture, as Math.sqrt could produce a non-integer. Consider adding a check to ensure the calculated width is an integer, or refactoring to have width and height passed in as parameters, similar to the createTexture function.

    // 对于 ArrayBuffer 或其他数据类型,需要提供宽度和高度
    const width = Math.sqrt(data.length / 4); // 假设是RGBA格式,每个像素4个值
    if (!Number.isInteger(width)) {
      console.warn('Texture data is not a square, which may cause rendering issues.');
    }
    const height = width;
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);

transform._calcMatrices();

expect(transform.customLayerMatrix()[0].toString().length).toBeGreaterThan(10);
console.log('----->1', transform.customLayerMatrix().length);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This console.log statement appears to be for debugging and should be removed from the test case.

Comment on lines +428 to +431
console.log('renderCanvas', renderCanvas);
if (!renderCanvas) {
throw new Error('地图尚未初始化完成,无法导出图片');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are a couple of issues here:

  1. A console.log statement has been added, which should be removed.
  2. The error message is in Chinese. For consistency with the rest of the codebase, please use English for error messages.
    if (!renderCanvas) {
      throw new Error('Map has not been initialized yet, unable to export image.');
    }

@lzxue
lzxue merged commit 2286667 into master Sep 19, 2025
6 checks passed
@lzxue
lzxue deleted the chore_ci_snap branch September 19, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant